/**
 ******************************* ICE *******************************
 * ========================================================================
 * Project:		iceapi
 * Package:		org.ice4apps.api.util
 * File:		ServiceUtil.java
 * Author: 		robin
 * Date: 		Feb 11, 2010
 * Description:	
 * ========================================================================
 * 
 */

package org.ice4apps.api.util;

import org.ice4apps.service.bean.LoginServiceRequest;
import org.ice4apps.util.IceLog;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;

public final class IceAPIServiceUtil {
    public static LoginServiceRequest getLoginRequest (String auth) {
        auth = auth.replaceAll ("Basic", "");
        byte[] bytes = Base64.decode (auth.trim ());
        auth = new String (bytes);
        String[] credentials = auth.split (":");
        LoginServiceRequest req = new LoginServiceRequest ();
        req.setClient (credentials[0]);
        req.setUserName (credentials[1]);
        req.setPassword (credentials[2]);
        return req;
    }
}
